import request from "@/utils/request";

/**
 * 部门树
 * @param { object } params
 * @param { string } params.deptName
 */
export const departmentTree = params => {
  return request({
    url: "/sass/dept/tree",
    method: "get",
    params
  });
};

/**
 * 查询部门下某角色的用户
 * @param { object } params
 * @param { string } params.deptId
 * @param { string } params.roleId
 */
export const userListByRole = params => {
  return request({
    url: "/sass/user/userListByDeptAndRoleId",
    method: "get",
    params
  });
};

/**
 *根据部门id查询部门人员
 * @param { object } params
 * @param { string } params.deptId
 * @returns {*}
 */
export const userListByDeptId = params => {
  return request({
    url: `/sass/dept/user/list`,
    method: "get",
    params
  });
};

/**
 * 查询部门中的业务人员
 * @param { Object } params
 * @param { string } params.deptId
 * @returns {*}
 */
export const userBusinessByDeptId = params => {
  return request({
    url: "/sass/sass/user/userList/business",
    method: "get",
    params
  });
};

/**
 * 查询人员对应部门
 * @param { string } userId
 */
export const userDeptByUserId = userId => {
  return request({
    url: `/sass/dept/userDeptList/${userId}`,
    method: "get"
  });
};

/**
 * 当前登录人所在部门树
 * @param { string } userId
 */
export const userDeptTreeByUserId = userId => {
  return request({
    url: `/sass/dept/select/${userId}`,
    method: "get"
  });
};

/**
 * 搜索人
 * @param { object } params
 * @param { string } params.name
 */
export const searchUser = params => {
  return request({
    url: "/sass/user/search",
    method: "get",
    params
  });
};
